//
//  UIView+JLY.m
//  Zuisuigirveup
//
//  Created by spdbmacbook0003 on 2025/8/8.
//

#import "UIView+JLY.h"

@implementation UIView (JLY)
- (void)JLYAddsjakdkciaxstracorlor:(UIColor *)startColor
                               endColor:(UIColor *)endColor
                             startPoint:(CGPoint)startPoint
                               endPoint:(CGPoint)endPoint {
    

    for (CALayer *layer in self.layer.sublayers) {
        if ([layer isKindOfClass:[CAGradientLayer class]]) {
            [layer removeFromSuperlayer];
        }
    }
    

    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
    gradientLayer.frame = self.bounds;
    gradientLayer.colors = @[(id)startColor.CGColor, (id)endColor.CGColor];
    gradientLayer.startPoint = startPoint;
    gradientLayer.endPoint = endPoint;
    gradientLayer.locations = @[@0.0, @1.0];
    

    [self.layer insertSublayer:gradientLayer atIndex:0];

    gradientLayer.cornerRadius = self.layer.cornerRadius;
}
@end
